<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>盒子模型</title>
  <style>
    #parent {
      border:1px solid red;
      width: 400px;
      height:400px;
      margin:40px;
      padding:30px;
    }
    #child {
      /* margin:20px; */
      /* margin-top:20px;
      margin-left:50px; */
      /*
      上右下左
      */
      /* margin:10px 0px 0px 40px; */
      /*上下为10，左右为20*/
      /*padding的设置方式和margin一模一样*/
      margin:10px 20px;
      padding:10px 40px;
      border:1px solid green;
      width: 300px;
      height: 200px;
    }
  </style>
</head>
<body>
  <div id="parent">
    <div id="child">
      这是内容
    </div>
  </div>
</body>
</html>